.TH E1432_GET_MEAS_WARNING 3 E1432
.SH NAME
.nf
e1432_get_meas_warning \- get warnings from the measurement
.fi
.IX e1432_get_meas_warning(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_get_meas_warning(E1432ID hw, SHORTSIZ16 ID, 
		SHORTSIZ16 *warning, unsigned long size, LONGSIZ32 *actualCount)
.cE
.SH DESCRIPTION
\fIe1432_get_meas_warning\fR returns zero or more warning codes from a 
measurement running in the E1432 module into a user buffer.  Warnings are
considered less serious than errors, which will stop a measurement.  Currently 
the only measurements which return warnings are rpm arming and 
Order Tracking measurements.
The warnings are defined in \fIerr1432.h\fR.  Warning messages can be obtained
using \fIe1432_get_warning_string\fR.  Warnings are currently issued
when arming points are missed or lost because of the following reasons:

\fBWARN1432_LOST_NOT_ENOUGH_TACHS\fR is issued when there is not enough
tach edges present to do the resampling calculation.

\fBWARN1432_LOST_TOO_MANY_TACHS\fR is issued when the tach pulses are coming
too fast to accomodate.  The internal tach time buffers have wrapped and erased
some of the tach times needed for the resampling calculation.

\fBWARN1432_LOST_TOO_MANY_POINTS_REQUIRED\fR is issued when the number of
data points needed for a resampling calculation is greater than the size of the
channel's span buffer in the FIFO.

\fBWARN1432_LOST_DATA_SHIFTED_OUT_FIFO\fR is issued when the measurement is 
falling behind and the data needed in the FIFO has already 
been overwritten by newer data before the FIFO could be stopped.

\fBWARN1432_LOST_NOT_ENOUGH_DATA_FIFO\fR is issued when there is not enough
data in the span buffer in the FIFO to do the resampling calculation.

\fBWARN1432_LOST_RPM_TOO_HIGH\fR is issued when the RPM calculated from the
tach input is greater than maximum allowed for the top span of data in the
FIFO.  This maximum is (top_span / max_order) * 60.0.

\fBWARN1432_LOST_RPM_TOO_LOW\fR is issued when the RPM calculated from the
tach input is lower than minimum allowed for the bottom span of data in the
FIFO.  This minimum is (bottom_span / max_order) * 60.0.

\fBWARN1432_LOST_RESAMPLE_ERROR\fR is issued when an internal computational
error occurs in the resampling calculation.  This should not happen.

\fBWARN1432_LOST_FIFO_EMPTIED\fR is issued when a stopped FIFO has 
finished emptying it's data.  The FIFO is stopped when the addition of new data 
would overwrite data needed for already queued arm points.  

\fBWARN1432_RPM_RAMP_TO_FAST\fR is issued when the tach RPM changes to fast
to be able to correctly resample the input data into the order domain.

A bit defined by \fBE1432_IRQ_MEAS_WARNING\fR is set in the status register, 
\fBE1432_IRQ_STATUS2_REG\fR when there are warnings available.  This bit can
be interrupted on.

\fIhw\fR must be the result of a successful call to
\fIe1432_assign_channel_numbers\fR, and specifies the group of
hardware to talk to.

\fIID\fR is a group ID of the channels involved in the measurement.

\fIwarning\fR is a pointer to an array into which the warning codes are placed. 

\fIsize\fR is the size, in elements, of \fIwarning\fR.  

\fBNote:\fR always make this size less than or equal to the actual allocated
memory for \fIwarning\fR or the function may overrun the array.

\fIactualCount\fR is a pointer to a long integer.  It is set to the
actual number of warning codes transferred into \fIwarning\fR.  It will
always be less than or equal to \fIsize\fR and may be zero, if no new
warnings were accumulated.

The following code illustrates how to query for errors, warnings and end of
measurment while looking for a block available:

.cS
#define WARNING_MAX	100

	/* Wait for block available, checking for errors, warnings and end */
	do
	{
	    e1432_get_meas_state(hw, inputs, &meas_state);
	    if(meas_state == E1432_MEAS_STATE_TESTED)
	    {
		printf("Measurement finished.\n");
		exit(0);
	    }

            e1432_read_register(hw, inputs, E1432_IRQ_STATUS2_REG, &status);
	    if(status & E1432_IRQ_MEAS_ERROR)
	    {

	        if(status & E1432_STATUS2_TACH_OVERFLOW)
		    (void) printf("Tach buffer overflowed\n");
		else
		    (void) printf("Fifo overflowed\n");
		exit(-1);
	    }

	    if(status & E1432_IRQ_MEAS_WARNING)
	    {
		/* read out all measurement warnings */
		while(status & E1432_IRQ_MEAS_WARNING)
		{
		    e1432_get_meas_warning(hw, inputs, warning, WARNING_MAX,
								&warningCount);
	   
		    if(warningCount)
		    {
	       		printf("%d Warning", warningCount);
			if(warningCount > 1) printf("s");
			printf(":\n");
		    }

           	    for(i=0; i < warningCount; i++)
			printf("   %s\n", e1432_get_warning_string(warning[i]);

		    e1432_read_register(hw, inputs, 	
					E1432_IRQ_STATUS2_REG, &status);
		}
	    }


	}while((status & E1432_IRQ_BLOCK_READY) == 0); 
.cE

.SH "RESET VALUE"
Not applicable.
.SH "RETURN VALUE"
Returns 0 if successful, a (negative) error number otherwise.
.SH "SEE ALSO"
e1432_get_warning_string
